package com.osdp.sc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.osdp.sc.entity.ScTenantUser;
import com.osdp.sc.vo.ScTenantUserVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ScTenantUserMapper extends BaseMapper<ScTenantUser> {

    @Select({"<script>",
            "  select utu.*, st.tenant_code from sc_tenant_user utu left join sc_tenant st on st.id = utu.tenant_id where utu.user_id = #{userId}" ,
            " </script>"})
    List<ScTenantUserVo> queryTenantUserByUserId(@Param("userId") String userId);

    @Select({"<script>",
            "  select utu.*, st.tenant_code from sc_tenant_user utu left join sc_tenant st on st.id = utu.tenant_id where st.tenant_id = #{tenantId}",
            " </script>"})
    List<ScTenantUserVo> queryTenantUserByTenanId(@Param("tenantId") String tenantId);


}
